<template>
  <!--明细页面弹出框-->
  <el-dialog
    title="银行票据维护审核明细"
    center
    :visible.sync="open"
    width="1024px"
    :close-on-click-modal="true"
    @close="closeFn"
  >
    <el-form ref="detailsForm" :model="formData" label-width="130px" disabled>
      <el-row>
        <el-col :span="12">
          <el-form-item label="交易流水号：" prop="id">
            <el-input v-model="formData.id" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="票据号码：" prop="draftNo">
            <el-input v-model="formData.draftNo" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="票据类型：" prop="draftType">
            <el-select style="width: 100%" v-model="formData.draftType" placeholder="">
              <el-option
                v-for="dict in dictMap.DRAFT_TYPE"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="票据种类：" prop="draftCode">
            <el-select style="width: 100%" v-model="formData.draftCode" placeholder="">
              <el-option
                v-for="dict in dictMap.DRAFT_CODE"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="出票日期：" prop="issuedDate">
            <el-date-picker
              v-model="formData.issuedDate"
              type="date"
              value-format="yyyyMMdd"
              placeholder=""
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="票据状态：" prop="status">
            <el-select style="width: 100%" v-model="formData.status" placeholder="">
              <el-option
                v-for="dict in dictMap.DRAFT_STATUS"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="出票行行号：" prop="issuedBrno">
            <el-input v-model="formData.issuedBrno" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="出票行行名：" prop="issuedBrname">
            <el-input v-model="formData.issuedBrname" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="代理付款行行号：" prop="agentBrno">
            <el-input v-model="formData.agentBrno" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="代理付款行行名：" prop="agentBrname">
            <el-input v-model="formData.agentBrname" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="申请人账号：" prop="issuedActno">
            <el-input v-model="formData.issuedActno" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="申请人名称：" prop="issuedName">
            <el-input v-model="formData.issuedName" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="收款人名称：" prop="payeeName">
            <el-input v-model="formData.payeeName" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="出票金额：" prop="issuedAmount">
            <el-input v-model="formData.issuedAmount" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="结算金额：" prop="payAmount">
            <el-input v-model="formData.payAmount" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="提示付款日期：" prop="promptDate">
            <el-date-picker
              v-model="formData.promptDate"
              type="date"
              value-format="yyyyMMdd"
              placeholder=""
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="兑付日期：" prop="payDate">
            <el-date-picker
              v-model="formData.payDate"
              type="date"
              value-format="yyyyMMdd"
              placeholder=""
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="密押：" prop="key">
            <el-input v-model="formData.key" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="打印次数：" prop="printCount">
            <el-input v-model="formData.printCount" />
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="12">
          <el-form-item label="录入操作员：" prop="mdTlrno">
            <el-input v-model="formData.mdTlrno" placeholder="" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="录入时间：" prop="mdTime">
            <el-date-picker
              v-model="formData.mdTime"
              type="datetime"
              value-format="yyyyMMddHHmmss"
              placeholder=""
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="审核操作员：" prop="audTlrno">
            <el-input v-model="formData.audTlrno" placeholder="" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="审核时间：" prop="audTime">
            <el-date-picker
              v-model="formData.audTime"
              type="datetime"
              value-format="yyyyMMddHHmmss"
              placeholder=""
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="维护操作员：" prop="edTlrno">
            <el-input v-model="formData.edTlrno" placeholder="" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="维护时间：" prop="edTime">
            <el-date-picker
              v-model="formData.edTime"
              type="datetime"
              value-format="yyyyMMddHHmmss"
              placeholder=""
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="24">
          <el-form-item label="备注：" prop="remarks">
            <el-input type="textarea" v-model="formData.remarks" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="24">
          <el-form-item label="维护附言：" prop="reasons">
            <el-input type="textarea" v-model="formData.reasons" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-form ref="detailsForm" :model="formData" label-width="130px">
      <el-row type="flex">
        <el-col :span="24">
          <el-form-item label="审核附言：" prop="audRemarks">
            <el-input type="textarea" v-model="formData.audRemarks" maxlength="384" show-word-limit />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="approveFn" :loading="isLoading">审核</el-button>
      <el-button type="danger" @click="rejectFn" :loading="isLoading">拒绝</el-button>
      <el-button @click="closeFn">关闭</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { approve, reject } from "@/api/cnaps/bepsDraft/bank_note_issuance_uphold_approve.js";

export default {
  name: "BankNoteIssuanceUpholdApproveDetails",
  components: {},
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    formData: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      // 是否显示弹出层
      open: false,
      isLoading: false,
    };
  },
  mounted() {},
  methods: {
    //审核
    approveFn() {
      this.isLoading = true;
      approve({ ...this.formData })
        .then((res) => {
          this.isLoading = false;
          this.$emit("editComplete", true);
          this.msgSuccess("成功!");
          this.closeFn();
        })
        .catch((err) => {
          this.isLoading = false;
          //   this.$alert(`${res.result}`, "系统提示", {
          //     confirmButtonText: "确认",
          //     type: "error",
          //     callback: (action) => {},
        });
    },
    rejectFn() {
      this.isLoading = true;
      reject({ ...this.formData })
        .then((res) => {
          this.isLoading = false;
          this.$emit("editComplete", true);
          this.msgSuccess("成功!");
          this.closeFn();
        })
        .catch((err) => {
          this.isLoading = false;
          //   this.$alert(`${res.result}`, "系统提示", {
          //     confirmButtonText: "确认",
          //     type: "error",
          //     callback: (action) => {},
        });
    },
    // 表单重置
    reset() {
      this.resetForm("submitForm");
    },
    closeFn() {
      this.open = false;
      this.reset();
    },
    show() {
      this.open = true;
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
